Shortest way of determining a name ends with an `s`, `x` or `z`, and then use the `I18n.t` method wi

Posted by Koning Baard XIV on Stack Overflow See other posts from Stack Overflow or by Koning Baard XIV
Published on 2010-04-10T18:44:37Z Indexed on 2010/04/10 18:53 UTC
Read the original article Hit count: 380

I'm creating a Rails application where users can have a first and last name. Since I'm a perfectionist, the application may not show something like Dennis's profile or Xianx's profile, but rather Dennis' profile and Xianx' profile. I use L18n, so I wanted to ask what is the shortest way of implementing this? This grammar is the same for both English and Dutch, where the application will be translated to.

Oh, some important things:

  • I am not afraid of using helpers and the application controller
  • My language files are in Ruby, not YAML

Thanks!

© Stack Overflow or respective owner

Related posts about localization

Related posts about language